package org.binglan.youziyuepai.mapper;

import org.apache.ibatis.annotations.Select;
import org.binglan.youziyuepai.entity.PhotographyTag;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.binglan.youziyuepai.vo.UserVo;

import java.util.List;

/**
 * <p>
 * 摄影标签表 Mapper 接口
 * </p>
 *
 * @author sanjin
 * @since 2019-04-09
 */
public interface PhotographyTagMapper extends BaseMapper<PhotographyTag> {


    /**
     * 获取用户所有标签
     */
    @Select("SELECT\n" +
            "\tt.* \n" +
            "FROM\n" +
            "\tphotography_tag t,\n" +
            "\tuser_to_photography_tag ut \n" +
            "WHERE\n" +
            "\tt.id = ut.photography_tag_id \n" +
            "\tAND ut.user_id = #{userId}")
    List<PhotographyTag> queryTagsByUserId(String userId);

    /**
     * 获取动态所有标签
     */
    @Select("" +
            "SELECT\n" +
            "\tt.* \n" +
            "FROM\n" +
            "\tphotography_tag t,\n" +
            "\tpersonal_dynamic_to_photography_tag pt \n" +
            "WHERE\n" +
            "\tt.id = pt.photography_tag_id \n" +
            "\tAND pt.personal_dynamic_id = #{personalDynamicId}")
    List<PhotographyTag> queryTagsByPersonalDynamicId(String personalDynamicId);

}
